#include "NewBox.h"
#include "ui_NewBox.h"
#include <QFileDialog>

NewBox::NewBox(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::NewBox)
{
    ui->setupUi(this);
    myAccepted = myDestroyed =  false;
    myWidth = myHeight = 0;
}

NewBox::~NewBox()
{
    delete ui;
}

void NewBox::on_buttonBox_accepted()
{
    myAccepted = true;
    myTileName = ui->tileSheet->text();
    myMapName = ui->mapName->text();
    myWidth = ui->width->value();
    myHeight = ui->height->value();
    tSize = ui->spinBox->value();

    destroy();
}



void NewBox::on_buttonBox_rejected()
{
    myDestroyed = true;

    destroy();

}

void NewBox::on_toolButton_clicked()
{
    QString tile = QFileDialog::getOpenFileName(this, "Choose a TileSheet");
    ui->tileSheet->setText(tile);
}
